package com.yxj01;

import java.io.File;

public class FileDemo03 {
    public static void main(String[] args) {
        File f1 = new File("myFile\\1.txt");
        System.out.println(f1.isDirectory());
        System.out.println(f1.isFile());
        System.out.println(f1.exists());
        System.out.println(f1.getAbsoluteFile());
        System.out.println(f1.getPath());
        System.out.println(f1.getName());
        System.out.println("==========");

        File f2 = new File("D:\\Ccode\\jdata-structure\\File7");
        String[] strArray = f2.list();
        for(String str : strArray) {
            System.out.println(str);
        }
        System.out.println("============");

        File[] fileArray = f2.listFiles();
        for(File f : fileArray) {
//            System.out.println(f);
//            System.out.println(f.getName());
            if(f.isFile()) {
                System.out.println(f.getName());
            }
        }
    }
}
